package com.neuedu.hcp.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neuedu.hcp.entity.OutRegistrate;
import com.neuedu.hcp.entity.Patient;
import com.neuedu.hcp.entity.RespPageBean;
import com.neuedu.hcp.mapper.OutRegistrateMapper;
import com.neuedu.hcp.service.IOutRegistrateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 第八组
 * @since 2021-04-26
 */
@Service
public class OutRegistrateServiceImpl extends ServiceImpl<OutRegistrateMapper, OutRegistrate> implements IOutRegistrateService {

    @Autowired
    private OutRegistrateMapper outRegistrateMapper;

    /**
     * 获取所有康复计划（分页）
     * @param currentPage
     * @param size
     * @param outRegistrate
     * @return
     */
    @Override
    public RespPageBean getOutListByPage(Integer currentPage, Integer size, OutRegistrate outRegistrate) {

            Page<OutRegistrate> page = new Page<>(currentPage,size);
            IPage<OutRegistrate> outRegistrateIPage=outRegistrateMapper.getOutListByPage(page,outRegistrate);
            RespPageBean respPageBean = new RespPageBean(outRegistrateIPage.getTotal(),outRegistrateIPage.getRecords());
            return respPageBean;

    }






    @Override
    public int insert(OutRegistrate outRegistrate) {
        return outRegistrateMapper.insert(outRegistrate);
    }


}
